//任务数据
class TaskModel {
	private dailyOrder = [];
    private dailyHave = [];
    private dailyComplete = [];
    private dailyFinish = [];

	constructor() {
        
    }

	//设置任务
	setTask():void{
		this.dailyHave = [];
		this.dailyComplete = [];
		this.dailyFinish = [];
		KBEngine.app.player().task_daily_list.forEach(v => {
			switch(v.state){
				case -2://已结束
					this.dailyFinish.push({id:v.id,state:-2});
					break;
				case -1://已完成
					this.dailyComplete.push({id:v.id,state:-1});
					break;
				default:
					this.dailyHave.push({id:v.id,state:v.state});
					break;
			}
		});
		this.orderDaily();
	}

	//每日任务排序
	orderDaily():void{
		this.dailyOrder = [];
		for(let i=0;i<this.dailyComplete.length;i++){
			this.dailyOrder.push(this.dailyComplete[i]);
		}
		for(let i=0;i<this.dailyHave.length;i++){
			this.dailyOrder.push(this.dailyHave[i]);
		}
		for(let i=0;i<this.dailyFinish.length;i++){
			this.dailyOrder.push(this.dailyFinish[i]);
		}
	}

	//结束一项任务
	setFinish(index:number):void{
	}
	
	getDailyOrder():any{
		return this.dailyOrder;
	}
	getDailyHave():any{
		return this.dailyHave;
	}
	getDailyComplete():any{
		return this.dailyComplete;
	}
	getDailyFinish():any{
		return this.dailyFinish;
	}
}
let taskModel : TaskModel = new TaskModel();
